import { createRouter, createWebHistory }
from 'vue-router'
import Home from '../views/home/Home.vue'
import Login from '../views/auth/Login.vue'
// 已删除不存在的Register.vue导入
import Reg from '../views/auth/Reg.vue'
import ExamList from '../views/exam/ExamList.vue'
import ExamDetail from '../views/exam/ExamDetail.vue'
import ExamProgress from '../views/exam/ExamProgress.vue'
import ExamResult from '../views/exam/ExamResult.vue'
import DailyReport from '../views/dailyReport/DailyReport.vue'
import Forum from '../views/forum/Forum.vue'
import ForumIndex from '../views/forum/ForumIndex.vue'
import PostDetail from '../views/forum/PostDetail.vue'
import Profile from '../views/profile/Profile.vue'
import EditProfile from '../views/profile/EditProfile.vue'

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', name: 'Login', component: Login },
  { path: '/register', name: 'Register', component: Reg },
  { path: '/home', name: 'Home', component: Home },
  { path: '/examList', name: 'ExamList', component: ExamList },
  { path: '/exam/:id', name: 'ExamDetail', component: ExamDetail },
  { path: '/exam/:id/progress', name: 'ExamProgress', component: ExamProgress },
  { path: '/exam/:id/result', name: 'ExamResult', component: ExamResult },
  { path: '/dailyReport', name: 'DailyReport', component: DailyReport },
  { path: '/forum', name: 'Forum', component: Forum, children: [
      { path: '', name: 'ForumIndex', component: ForumIndex },
      { path: 'post/:id', name: 'PostDetail', component: PostDetail }
    ]
  },
  { path: '/profile', name: 'Profile', component: Profile },
  { path: '/reg', name: 'Reg', component: Reg },
  { path: '/editProfile', name: 'EditProfile', component: EditProfile }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router